import java.util.Scanner;

public class Service {
    Scanner scanner=new Scanner(System.in);
    private int id=2;
    private int houseNum=1;
    private House[]houses;
    public Service (int size){
        houses=new House[size];
        houses[0]=new House(1,"张策","176","北京",300,"未出租");
    }
    public void uodate(int id){
        System.out.println("姓名:");
        String name=scanner.nextLine();
        houses[id-1].setName(name);
    }
    public void find(int id){
        System.out.println(houses[id-1]);
    }

    public House[] serlist(){
        return houses;
    }
    public boolean sub(int choice){
        if(choice<=0||choice>this.houseNum){
            System.out.println("编号错误");
            return false;
        }
        for (int i = choice-1; i <this.houseNum; i++) {
            houses[i]=houses[i+1];
            houses[this.houseNum-1]=null;
            this.houseNum--;
            this.id--;
            System.out.println("删除成功");
            return true;
        }
        return false;
    }
    public void add(House house){
        if(houseNum== houses.length){
            System.out.println("满了无法添加");
        }
        else {
            houses[houseNum]=house;
            System.out.println("添加成功");
            this.houseNum++;
            this.id++;
        }

    }

    public int getId() {
        return id;
    }
}
